﻿using System.Web.Mvc;
using Asd.MP.Utility;

namespace MobilePlatform.Controllers
{
    public partial class BaseController
    {

        /// <summary>
        /// 全功能的 MessageResult
        /// </summary>
        /// <param name="message">用于前台显示的强类型消息Model</param>
        /// <returns>ResultType</returns>
        protected ActionResult MessageResult(MessageViewModel message)
        {
            return this.MessageResult(message, ResultType.View);
        }
        /// <summary>
        /// 全功能的 MessageResult
        /// </summary>
        /// <param name="message">用于前台显示的强类型消息Model</param>
        /// <param name="resultType">Action Result</param>
        /// <returns>ResultType</returns>
        protected ActionResult MessageResult(MessageViewModel message, ResultType resultType)
        {
            switch (resultType)
            {
                case ResultType.Json:
                    return Json(message);
                case ResultType.Ajax:
                    return View("AjaxMessage", message);
                default:
                    return View("Message", message);
            }
        }
    }
}
